package bookTrading;

import jade.core.Profile;
import jade.core.ProfileImpl;
import jade.core.Runtime;
import jade.wrapper.AgentContainer;
import jade.wrapper.AgentController;
import jade.wrapper.StaleProxyException;

/**
 * @Name: BookGo
 * @Description:
 * @Author: colfish
 * @Date: 2021/5/8 10:19
 * 好好学习，天天向上！
 */
public class BookGo {
    public static void main(String[] args) {
        Runtime runtime = Runtime.instance();
        Profile mainConfig = new ProfileImpl("localhost", 8888, null);
        mainConfig.setParameter("gui", "false");
        AgentContainer mainContainer = runtime.createMainContainer(mainConfig);
        try {
            AgentController sellerController = mainContainer.createNewAgent("seller", BookSellerAgent.class.getName(),null);
            sellerController.start();
            Object[] arg = new Object[]{"Tom"};
            AgentController buyerController = mainContainer.createNewAgent("buyer", BookBuyerAgent.class.getName(),arg);
            buyerController.start();
        } catch (StaleProxyException e) {
            e.printStackTrace();
        }

    }
}
